home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / falcon / programm.ing / nt_dsp1.lzh / NT_DSP1.MSA / LFLTS / LATGEN.ASM < prev    next >
Assembly Source File  |  1989-01-24  |  1KB  |  40 lines

  1. ;
  2. ; This program originally available on the Motorola DSP bulletin board.
  3. ; It is provided under a DISCLAMER OF WARRANTY available from
  4. ; Motorola DSP Operation, 6501 Wm. Cannon Drive W., Austin, Tx., 78735.
  5. ; Generalized Lattice FIR/IIR Filter Macro.
  6. ; Last Update 08 Aug 86   Version 1.0
  7. ;
  8. latgen        macro   order
  9. latgen        ident   1,0
  10. ;
  11. ;     Generalized Lattice FIR/IIR
  12. ;
  13. ;     Input value in register A, output value in register A.
  14. ;
  15. ;     Macro call:
  16. ;             latgen  order           ;call macro
  17. ;
  18. ;     where 'order' is the number of K coefficients.
  19. ;
  20. ;     Alters registers: x0 x1 y0 a b, r0 r4, pc sr
  21. ;
  22. ;     uses 2 locations on the stack.
  23. ;
  24. ;
  25.   move           x:(r0)+,x0  y:(r4)-,y0     ;get first k, first s
  26.   do    #order,_el                          ;calculate states
  27.   macr  -x0,y0,a             b,y:(r4)+      ;a-k*s, save prev s
  28.   move            a,x1       y:(r4)+,b      ;set a for mul, s again 
  29.   macr  x1,x0,b  x:(r0)+,x0  y:(r4)-,y0     ;a*k+s, k, nxt s
  30. _el
  31.   move                       b,y:(r4)+      ;sv scnd to 1st st
  32.   clr   a                    a,y:(r4)+      ;save first state
  33.   move                       y:(r4)+,y0     ;get last state
  34.   rep   #order
  35.   mac   x0,y0,a  x:(r0)+,x0  y:(r4)+,y0     ;do fir taps
  36.   macr  x0,y0,a              (r4)+          ;mac and round, adj pointer
  37.   endm
  38.